#ifndef _GENERATOR_H_
#define _GENERATOR_H_

#if defined(_MSC_VER)  &&  _MSC_VER >= 1310
# pragma warning( disable: 4018 )     // disable signed/unsigned warning
#endif 

#include <vector>

#include "json/json.h"
#include "Checker.h"
#include "Query.h"

#define MAX_PRIORITY 0x7fffffff

//class SearchEngine;

class Generator
{
private:
	std::string name;
	int property;
	int priority;
	
	virtual void generate(std::vector <OperatorNode *> :: iterator begin) = 0;
protected:
	Query *query;
	QueryStorage *queryStorage;

	Checker *checker;

	std::vector <OperatorNode *> opsList;

	int *number;
	//SearchEngine *searchEngine;
	int startpos;

	Query *createQuery(std::vector <OperatorNode *> :: iterator it);
	void createQuery(std::vector <OperatorNode *> :: iterator it, Query *q, Query *based);
public:
	Generator(std::string name, int property, int priority = MAX_PRIORITY);
	virtual ~Generator();

	virtual bool generate(Query *q, QueryStorage *qs, int startpos, int *queryNumber) = 0;

	inline int getProperty();

	bool operator < (const Generator &g);
};

typedef std::vector<Generator *> Generators;

#endif